Repository navigation
Make converting a cyclic error a catchable RangeError - #9
Merged
Merged
Conversation
📋 Release PreviewChangelog0.3.0 (2026-10-19)🚀 Features🩹 Bug Fixes
📖 Documentation
🔄️ Continuous Integration
|
There was a problem hiding this comment.
🔵 Needs a closer look
Fix array conversion when .map is overridden and correct the test description typo.
No open issues 🎉
What changed in this PR
Updates error string conversion to turn cyclic references into catchable RangeErrors while preserving JavaScript-style array cycle behavior.
Changes:
- Adds shared tracking for nested conversions and array cycles.
- Updates error, object, argument, and string conversions.
- Adds tests, parity cases, and documentation.
| File | Summary |
|---|---|
packages/maple/src/values/sandbox-object.ts |
Extends the conversion interface. |
packages/maple/src/values/sandbox-error.ts |
Bounds recursive error conversion. |
packages/maple/src/values/coercion.ts |
Tracks recursive conversions and array cycles. |
packages/maple/src/values/coercion.spec.ts |
Tests conversion cycles and limits. |
packages/maple/src/values/arguments.ts |
Updates string conversion callbacks. |
packages/maple/src/errors.spec.ts |
Tests catchable cyclic-error failures. |
packages/maple/src/builtins/string/methods/concat.ts |
Updates string argument conversion. |
packages/maple/src/builtins/object/object.spec.ts |
Tests cyclic error behavior. |
packages/maple/docs/limits.md |
Documents conversion limits. |
packages/maple-parity/src/divergences.spec.ts |
Adds parity cases. |
packages/maple-parity/README.md |
Documents parity divergences. |
Review effort: Lite
An error whose name or message led back to itself was converted until the host ran out of stack, ending the run past the script's catch and finally. Converting errors inside one another now stops at the nesting limit with JavaScript's RangeError, and join cuts a cycle through an array across nested conversions, as JavaScript does.
NetWin
force-pushed
the
fix/cyclic-error-conversion
branch
from
October 19, 2026 20:03
6342c58 to
8b45f9d
Compare
Merged
|
🎉 This PR is included in version 0.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Converting an error whose
nameormessageleads back to itself ran until the host's stack overflowed and ended the run past the script'scatchandfinally. It now throws JavaScript'sRangeError: Maximum call stack size exceeded, which the script can catch.A cycle through an array is cut by
joinas in JavaScript, soe.name = [e]converts tom: m. Reported in #6 (comment).